package com.tiandao.mofang.core.bpjn;

import com.tiandao.mofang.core.RobotSingleton;

import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class DianSkills implements Runnable{
    public static Robot robot = RobotSingleton.getInstance();

    public static void main(String[] args) {
        //综合能力显示屏坐标1920*1080
//        robot.mouseMove(480,396);
        //技能屏幕坐标
//        robot.mouseMove(630,525);//1
//        robot.mouseMove(880,525);//2
//        robot.mouseMove(1130,525);//3
//        robot.mouseMove(1380,525);//4

//        robot.mouseMove(630,617);//1
//        robot.mouseMove(880,617);//2
//        robot.mouseMove(1130,617);//3
//        robot.mouseMove(1380,617);//4


//        robot.mouseMove(630,710);//1
//        robot.mouseMove(880,710);//2
//        robot.mouseMove(1130,710);//3     i为奇数有
        //robot.mouseMove(690,396);//3
        //确定按钮坐标
//        robot.mouseMove(875,410);
    }
    @Override
    public void run() {
        int i = 1;
        while (true){
            if(i==1){
                try {
                    Thread.sleep(3000);
                    robot.keyPress(KeyEvent.VK_O);
                    robot.keyRelease(KeyEvent.VK_O);
                    Thread.sleep(1500);
                    robot.mouseMove(733,365);
                    Thread.sleep(1500);
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_MASK);
                    Thread.sleep(1000);
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_MASK);
                    Thread.sleep(1500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            if(i%2!=0){
                //奇数
                try {
                    //综合能力按钮位置
                    robot.mouseMove(480,396);
                    Thread.sleep(1000);
                    //点击综合能力
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_MASK);
                    Thread.sleep(1000);
                    dianSkill(630,525,1);
                    dianSkill(880,525,2);
                    dianSkill(1130,525,3);
                    dianSkill(1380,525,4);
                    dianSkill(630,617,5);
                    dianSkill(880,617,6);
                    dianSkill(1130,617,7);
                    dianSkill(1380,617,8);
                    dianSkill(630,710,9);
                    dianSkill(880,710,10);
                    dianSkill(1130,710,11);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }else{
                //偶数
                //奇数
                try {
                    //综合能力按钮位置
                    robot.mouseMove(690,396);
                    Thread.sleep(1001);
                    //点击综合能力
                    robot.mousePress(InputEvent.BUTTON1_MASK);
                    robot.mouseRelease(InputEvent.BUTTON1_MASK);
                    Thread.sleep(1001);
                    dianSkill(630,525,2);
                    dianSkill(880,525,7);
                    dianSkill(1130,525,6);
                    dianSkill(1380,525,5);
                    dianSkill(630,617,3);
                    dianSkill(880,617,10);
                    dianSkill(1130,617,9);
                    dianSkill(1380,617,1);
                    dianSkill(630,710,4);
                    dianSkill(880,710,8);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            i++;
        }
    }

    public static void dianSkill(int x ,int y,int j){

        try {
            Thread.sleep(800+(j*100));
            //一技能位置
            robot.mouseMove(x,y);
            Thread.sleep(800+(j*100));
            //点击学习
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
            Thread.sleep(800+(j*100));
            //确定按钮位置
            robot.mouseMove(875,410);
            Thread.sleep(800+(j*100));
            //点击确定按钮
            robot.mousePress(InputEvent.BUTTON1_MASK);
            robot.mouseRelease(InputEvent.BUTTON1_MASK);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
